<?php

namespace app\home\controller;

use think\Controller;

class CurlRequestTest extends Controller
{
    public function testCurlRequest()
    {
        // 测试正常请求
        $url = 'https://example.com';
        $post = true;
        $params = ['key1' => 'value1', 'key2' => 'value2'];
        $https = true;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);

        // 测试非 POST 请求
        $post = false;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);

        // 测试非 HTTPS 请求
        $https = false;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);
    }
}
